﻿using UnityEngine;
using System.Collections;

public class RuntimeMeshChanger : MonoBehaviour 
{

	public GameObject[]				HighGoArray = null;
	public GameObject[]				LowGoArray = null;


	int								mCurLevel = -1;

	void Start()
	{		
		if( BattleManager.Instance == null )
		{
			this.ChangeToLow();
		}
	}


	void SetActiveToHigh( bool bOK )
	{
		if( this.HighGoArray == null )
			return;
		for ( int i = 0; i < this.HighGoArray.Length; ++i )
		{
			GameObject goCur = this.HighGoArray[ i ];
			if ( goCur == null )
				continue;
			goCur.SetActive ( bOK );
		}
	}
	void SetActiveToLow( bool bOK )
	{
		if( this.LowGoArray == null )
			return;
		for( int i = 0;		i < this.LowGoArray.Length;		++i )
		{
			GameObject goCur = this.LowGoArray[ i ];
			if( goCur == null )
				continue;
			goCur.SetActive( bOK );
		}
	}

	public void ChangeToHigh()
	{
		if( this.mCurLevel == 0 )
			return;

		this.SetActiveToHigh( true );
		this.SetActiveToLow( false );
		this.mCurLevel = 0;
	}
	public void ChangeToLow()
	{
		if( this.mCurLevel == 1 )
			return;
		this.SetActiveToHigh( false );
		this.SetActiveToLow( true );		
		this.mCurLevel = 1;
	}

}
